﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

///<summary>
///
///</summary>
public class GroundEnemyWin : MonoBehaviour
{
    GameObject enemyWin;
    GameObject endLight;
    public bool IsOpen = false;
    Vector2 pos;
    private void Start()
    {
        enemyWin = GameObject.Find("Canvas/GameView/BackGround/triggerWin/Enemy");
        endLight = GameObject.Find("Canvas/GameView/BackGround/endRedBg");
        pos = transform.position;
    }
    public void End()
    {
        enemyWin.GetComponent<Animator>().SetBool("RestGame", false);
        enemyWin.GetComponent<Animator>().SetBool("IsRest", false);
        //怪物
        enemyWin.GetComponent<Animator>().SetBool("IsEnd", true);
        //闪烁红光
        endLight.GetComponent<Animator>().SetBool("IsEnd", true);
        Debug.Log("怪物胜利动画");
        IsOpen = true;
		AudioManager.GetInstance.Play("Sounds/gameOver/bell");

	}
    public void RestGame()
    {
        enemyWin.GetComponent<Animator>().SetBool("IsEnd", false);
        enemyWin.GetComponent<Animator>().SetBool("RestGame", true);
        endLight.GetComponent<Animator>().SetBool("IsEnd", false);
        IsOpen = false;
    }
    public void ReturnInitPos()
    {
        enemyWin.GetComponent<Animator>().SetBool("IsRest", true);
        enemyWin.GetComponent<Animator>().SetBool("IsEnd", false);
        endLight.GetComponent<Animator>().SetBool("IsEnd", false);
        IsOpen = false;
    }
}
